from pyecharts.charts import  Bar,Timeline
from pyecharts.options import LabelOpts
from pyecharts.globals import ThemeType
bar1=Bar()
bar1.add_xaxis(["中国","美国","英国"])
bar1.add_yaxis("GDP",[30,20,10],label_opts=LabelOpts(position="right"))
bar1.reversal_axis()

bar2=Bar()
bar2.add_xaxis(["中国","美国","英国"])
bar2.add_yaxis("GDP",[50,60,80],label_opts=LabelOpts(position="right"))
bar2.reversal_axis()

bar3=Bar()
bar3.add_xaxis(["中国","美国","英国"])
bar3.add_yaxis("GDP",[90,70,40],label_opts=LabelOpts(position="right"))
bar3.reversal_axis()

time_line=Timeline(
    {"theme":ThemeType.PURPLE_PASSION}
)
time_line.add(bar1,"点1")
time_line.add(bar2,"点2")
time_line.add(bar3,"点3")
#自动播放
time_line.add_schema(
    play_interval=1000,#自动播放间隔，单位毫秒
    is_timeline_show=True,#显示时间线
    is_auto_play=True,#自动播放
    is_loop_play=True#循环播放
)
#用时间线绘图
time_line.render("时间线.html")